package com.hjm.project.tBankinfo.tBankinfo.controller;

import java.util.List;
import java.util.Map;

import com.hjm.common.utils.DateUtils;
import com.hjm.common.utils.Utils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.hjm.framework.aspectj.lang.annotation.Log;
import com.hjm.framework.aspectj.lang.enums.BusinessType;
import com.hjm.project.tBankinfo.tBankinfo.domain.TBankinfo;
import com.hjm.project.tBankinfo.tBankinfo.service.ITBankinfoService;
import com.hjm.framework.web.controller.BaseController;
import com.hjm.framework.web.domain.AjaxResult;
import com.hjm.common.utils.poi.ExcelUtil;
import com.hjm.framework.web.page.TableDataInfo;

/**
 * 商编Controller
 * 
 * @author LOVE
 * @date 2020-11-28
 */
@Controller
@RequestMapping("/tBankinfo/tBankinfo")
public class TBankinfoController extends BaseController
{
    private String prefix = "tBankinfo/tBankinfo";

    @Autowired
    private ITBankinfoService tBankinfoService;

    @RequiresPermissions("tBankinfo:tBankinfo:view")
    @GetMapping()
    public String tBankinfo()
    {
        return prefix + "/tBankinfo";
    }

    /**
     * 查询商编列表
     */
    @RequiresPermissions("tBankinfo:tBankinfo:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TBankinfo tBankinfo)
    {
        startPage();
        List<TBankinfo> list = tBankinfoService.selectTBankinfoList(tBankinfo);
        return getDataTable(list);
    }

    /**
     * 导出商编列表
     */
    @RequiresPermissions("tBankinfo:tBankinfo:export")
    @Log(title = "商编", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TBankinfo tBankinfo)
    {
        List<TBankinfo> list = tBankinfoService.selectTBankinfoList(tBankinfo);
        ExcelUtil<TBankinfo> util = new ExcelUtil<TBankinfo>(TBankinfo.class);
        return util.exportExcel(list, "tBankinfo");
    }

    /**
     * 新增商编
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存商编
     */
    @RequiresPermissions("tBankinfo:tBankinfo:add")
    @Log(title = "商编", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(TBankinfo tBankinfo)
    {
        return toAjax(tBankinfoService.insertTBankinfo(tBankinfo));
    }


    /**
     * 删除商编
     */
    @RequiresPermissions("tBankinfo:tBankinfo:remove")
    @Log(title = "商编", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(tBankinfoService.deleteTBankinfoByIds(ids));
    }


    /**----------------------------------------------------------------查询管理----------------------------------------------------------------------*/
    /**
     * 查询各地区类型交易
     */
    @RequiresPermissions("tBankinfo:tBankinfo:dataList")
    @GetMapping("/dataList")
    public String dataList(ModelMap mmap)
    {
        mmap.put("mindDate", DateUtils.getDate());
        mmap.put("maxDate", DateUtils.getDate());
        return prefix + "/dataList";
    }

    /**
     * 查询各地区类型交易
     */
    @RequiresPermissions("tBankinfo:tBankinfo:dataListMap")
    @PostMapping("/dataListMap")
    @ResponseBody
    public TableDataInfo dataListMap(@RequestParam Map<String,Object> params) throws Exception
    {
        startPage();
        List<Map<String,Object>> list = tBankinfoService.getDataList(params);
        return getDataTable(list);
    }

    /**
     * 查询类型交易
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listOne")
    @GetMapping("/listOne")
    public String listOne(ModelMap mmap)
    {
        mmap.put("mindDate", DateUtils.getDate());
        mmap.put("maxDate", DateUtils.getDate());
        return prefix + "/listOne";
    }

    /**
     * 查询类型交易
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listOneMap")
    @PostMapping("/listOneMap")
    @ResponseBody
    public TableDataInfo listOneMap(@RequestParam Map<String,Object> params) throws Exception
    {
        startPage();
        List<Map<String,Object>> list = tBankinfoService.getListOneMap(params);
        return getDataTable(list);
    }


    /**
     * 查询交易量
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listTwo")
    @GetMapping("/listTwo")
    public String listTwo(ModelMap mmap)
    {
        mmap.put("mindDate", DateUtils.getDate());
        mmap.put("maxDate", DateUtils.getDate());
        return prefix + "/listTwo";
    }

    /**
     * 查询交易量
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listTwoMap")
    @PostMapping("/listTwoMap")
    @ResponseBody
    public TableDataInfo listTwoMap(@RequestParam Map<String,Object> params) throws Exception
    {
        startPage();
        List<Map<String,Object>> list = tBankinfoService.getListTwoMap(params);
        return getDataTable(list);
    }

    /**
     * 查询各省商编数量
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listThree")
    @GetMapping("/listThree")
    public String listThree(ModelMap mmap)
    {
        return prefix + "/listThree";
    }

    /**
     * 查询各省商编数量
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listThreeMap")
    @PostMapping("/listThreeMap")
    @ResponseBody
    public TableDataInfo listThreeMap(@RequestParam Map<String,Object> params) throws Exception
    {
        startPage();
        List<Map<String,Object>> list = tBankinfoService.getListThreeMap(params);
        return getDataTable(list);
    }

    /**
     * 查询地区码
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listFour")
    @GetMapping("/listFour")
    public String listFour(ModelMap mmap)
    {
        return prefix + "/listFour";
    }

    /**
     * 查询地区码
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listFourMap")
    @PostMapping("/listFourMap")
    @ResponseBody
    public TableDataInfo listFourMap(@RequestParam Map<String,Object> params) throws Exception
    {
        startPage();
        List<Map<String,Object>> list = tBankinfoService.getListFourMap(params);
        return getDataTable(list);
    }


    /**
     * 查询商编明细
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listTBankInfo")
    @GetMapping("/listTBankInfo")
    public String listTBankInfo(ModelMap mmap)
    {
        mmap.put("mindDate", DateUtils.getDate());
        mmap.put("maxDate", DateUtils.getDate());
        return prefix + "/listTBankInfo";
    }

    /**
     * 查询商编明细
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listTBankInfoMap")
    @PostMapping("/listTBankInfoMap")
    @ResponseBody
    public TableDataInfo listTBankInfoMap(@RequestParam Map<String,Object> params) throws Exception
    {
        startPage();
        List<Map<String,Object>> list = tBankinfoService.getListTBankInfoMap(params);
        return getDataTable(list);
    }
    /**
     * 修改商编
     */
    @GetMapping("/edit/{tid}")
    public String edit(@PathVariable("tid") String tid, ModelMap mmap)
    {
        TBankinfo tBankinfo = tBankinfoService.selectTBankinfoById(tid);
        mmap.put("tBankinfo", tBankinfo);
        return prefix + "/edit";
    }

    /**
     * 修改保存商编
     */
    @RequiresPermissions("tBankinfo:tBankinfo:edit")
    @Log(title = "商编", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(TBankinfo tBankinfo)
    {
        return toAjax(tBankinfoService.updateTBankinfo(tBankinfo));
    }

    /**
     * POS绑定明细
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listPosBinding")
    @GetMapping("/listPosBinding")
    public String listPosBinding(ModelMap mmap)
    {
        mmap.put("mindDate", DateUtils.getDate());
        mmap.put("maxDate", DateUtils.getDate());
        return prefix + "/listPosBinding";
    }

    /**
     * POS绑定明细
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listPosBindingMap")
    @PostMapping("/listPosBindingMap")
    @ResponseBody
    public TableDataInfo listPosBindingMap(@RequestParam Map<String,Object> params) throws Exception
    {
        startPage();
        List<Map<String,Object>> list = tBankinfoService.getPosBinding(params);
        return getDataTable(list);
    }


    /**
     * 新增POS绑定明细
     */
    @GetMapping("/addPosBinding")
    public String addPosBinding()
    {
        return prefix + "/addPosBinding";
    }

    /**
     * 新增保存POS绑定明细
     */
    @RequiresPermissions("tBankinfo:tBankinfo:addPosBinding")
    @Log(title = "POS绑定明细", businessType = BusinessType.INSERT)
    @PostMapping("/addPosBinding")
    @ResponseBody
    public AjaxResult addSavePosBinding(@RequestParam Map<String,Object> params)
    {
        params.put("entering_time", Utils.formateDate(0));
        params.put("entering_man", this.getSysUser().getLoginName());
        return toAjax(tBankinfoService.insertPosBinding(params));
    }

    /**
     * 修改POS绑定明细
     */
    @GetMapping("/editPosBinding/{bno}")
    public String editPosBinding(@PathVariable("bno") String bno, ModelMap mmap)
    {
        Map<String,Object> params=  tBankinfoService.selectPosBindingById(bno);
        mmap.put("posBinding", params);
        return prefix + "/editPosBinding";
    }

    /**
     * 修改保存POS绑定明细
     */
    @RequiresPermissions("tBankinfo:tBankinfo:editSavePosBinding")
    @Log(title = "POS绑定明细", businessType = BusinessType.UPDATE)
    @PostMapping("/editSavePosBinding")
    @ResponseBody
    public AjaxResult editSavePosBinding(@RequestParam Map<String,Object> params)
    {
        return toAjax(tBankinfoService.updatePosBinding(params));
    }

    /**
     * 删除POS绑定明细
     */
    @RequiresPermissions("tBankinfo:binding:removePosBinding")
    @Log(title = "POS绑定明细", businessType = BusinessType.DELETE)
    @PostMapping( "/removePosBinding")
    @ResponseBody
    public AjaxResult removePosBinding(String bno)
    {
        return toAjax(tBankinfoService.deletePosBindingByIds(bno));
    }
    /**
     * 地区交易量1
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listRoutRateType")
    @GetMapping("/listRoutRateType")
    public String listRoutRateType(ModelMap mmap)
    {
        return prefix + "/listRoutRateType";
    }

    /**
     * 地区交易量1
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listRoutRateTypeMap")
    @PostMapping("/listRoutRateTypeMap")
    @ResponseBody
    public TableDataInfo listRoutRateTypeMap(@RequestParam Map<String,Object> params) throws Exception
    {
        startPage();
        List<Map<String,Object>> list = tBankinfoService.getRoutRateType(params);
        return getDataTable(list);
    }

    /**
     * 新增地区交易量1
     */
    @GetMapping("/addRoutRateType")
    public String addRoutRateType()
    {
        return prefix + "/addRoutRateType";
    }

    /**
     * 新增保存地区交易量1
     */
    @RequiresPermissions("tBankinfo:tBankinfo:addRoutRateType")
    @Log(title = "地区交易量1", businessType = BusinessType.INSERT)
    @PostMapping("/addRoutRateType")
    @ResponseBody
    public AjaxResult addSaveRoutRateType(@RequestParam Map<String,Object> params)
    {
        return toAjax(tBankinfoService.insertRoutRateType(params));
    }

    /**
     * 修改地区交易量1
     */
    @GetMapping("/editRoutRateType/{id}")
    public String editRoutRateType(@PathVariable("id") String id, ModelMap mmap)
    {
        Map<String,Object> params=  tBankinfoService.selectRoutRateTypeById(id);
        mmap.put("routRateType", params);
        return prefix + "/editRoutRateType";
    }

    /**
     * 修改保存地区交易量1
     */
    @RequiresPermissions("tBankinfo:tBankinfo:editSaveRoutRateType")
    @Log(title = "修改保存地区交易量1", businessType = BusinessType.UPDATE)
    @PostMapping("/editSaveRoutRateType")
    @ResponseBody
    public AjaxResult editSaveRoutRateType(@RequestParam Map<String,Object> params)
    {
        return toAjax(tBankinfoService.updateRoutRateType(params));
    }

    /**
     * 删除地区交易量1
     */
    @RequiresPermissions("tBankinfo:binding:removeRoutRateType")
    @Log(title = "删除地区交易量1", businessType = BusinessType.DELETE)
    @PostMapping( "/removeRoutRateType")
    @ResponseBody
    public AjaxResult removeRoutRateType(String id)
    {
        return toAjax(tBankinfoService.deleteRoutRateTypeByIds(id));
    }
    /**
     * 规则1
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listBankBnoSerialInfo")
    @GetMapping("/listBankBnoSerialInfo")
    public String listBankBnoSerialInfo(ModelMap mmap)
    {
        return prefix + "/listBankBnoSerialInfo";
    }

    /**
     * 规则1
     */
    @RequiresPermissions("tBankinfo:tBankinfo:listBankBnoSerialInfoMap")
    @PostMapping("/listBankBnoSerialInfoMap")
    @ResponseBody
    public TableDataInfo listBankBnoSerialInfoMap(@RequestParam Map<String,Object> params) throws Exception
    {
        startPage();
        List<Map<String,Object>> list = tBankinfoService.getBankBnoSerialInfo(params);
        return getDataTable(list);
    }


    /**
     * 新增规则1
     */
    @GetMapping("/addBankBnoSerialInfo")
    public String addBankBnoSerialInfo()
    {
        return prefix + "/addBankBnoSerialInfo";
    }

    /**
     * 新增保存新增规则1
     */
    @RequiresPermissions("tBankinfo:tBankinfo:addBankBnoSerialInfo")
    @Log(title = "新增保存新增规则1", businessType = BusinessType.INSERT)
    @PostMapping("/addBankBnoSerialInfo")
    @ResponseBody
    public AjaxResult addBankBnoSerialInfo(@RequestParam Map<String,Object> params)
    {
        return toAjax(tBankinfoService.insertBankBnoSerialInfo(params));
    }

    /**
     * 修改规则1
     */
    @GetMapping("/editBankBnoSerialInfo/{bankbno}")
    public String editBankBnoSerialInfo(@PathVariable("bankbno") String bankbno, ModelMap mmap)
    {
        Map<String,Object> params=  tBankinfoService.selectBankBnoSerialInfoById(bankbno);
        mmap.put("bankBnoSerialInfo", params);
        return prefix + "/editBankBnoSerialInfo";
    }

    /**
     * 修改保存规则1
     */
    @RequiresPermissions("tBankinfo:tBankinfo:editSaveBankBnoSerialInfo")
    @Log(title = "修改保存规则1", businessType = BusinessType.UPDATE)
    @PostMapping("/editSaveBankBnoSerialInfo")
    @ResponseBody
    public AjaxResult editSaveBankBnoSerialInfo(@RequestParam Map<String,Object> params)
    {
        return toAjax(tBankinfoService.updateBankBnoSerialInfo(params));
    }

    /**
     * 删除规则1
     */
    @RequiresPermissions("tBankinfo:binding:removeBankBnoSerialInfo")
    @Log(title = "删除规则1", businessType = BusinessType.DELETE)
    @PostMapping( "/removeBankBnoSerialInfo")
    @ResponseBody
    public AjaxResult removeBankBnoSerialInfo(String bankbno)
    {
        return toAjax(tBankinfoService.deleteBankBnoSerialInfo(bankbno));
    }
}
